from  time import sleep
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains   #鼠标操作
from selenium.webdriver.common.keys import Keys    #按键操作
driver=webdriver.Chrome()
driver.maximize_window()
driver.implicitly_wait(10)
driver.get('https://www.baidu.com/')
ele= driver.find_element_by_id('s-usersetting-top')
# ele= driver.find_element_by_name('tj_settingicon')
sleep(2)
ActionChains(driver).move_to_element(ele).perform()     #perrform    执行的动作     tj_settingicon

driver.find_element_by_name('wd').send_keys('哈哈哈哈哈')
sleep(2)
driver.find_element_by_name('wd').send_keys(Keys.CONTROL,'a')   #模拟键盘输入操作
sleep(2)
driver.find_element_by_name('wd').send_keys(Keys.CONTROL,'x')    #模拟键盘输入操作  control+x
sleep(2)
driver.find_element_by_name('wd').send_keys(Keys.CONTROL,Keys.SHIFT,'v')   #组合按键
sleep(2)
driver.find_element_by_id('su').click()
sleep(2)
js='window.scrollTo(0,1000)'        #javascript   语法   X轴    y 轴           赋值='window.scrollTo(x轴,y轴)'
driver.execute_script(js)              #执行脚本               driver.execute_script(上面的赋值)
sleep(2)
# driver.get_screenshot_as_file('../wenjian/tupian/wodeshijie.png')    #保存图片
driver.get_screenshot_as_file('../wenjian/tupian/hahahahaha.png')
sleep(2)
# driver.quit()

# driver.find_element_by_name('wd').send_keys(Keys.CONTROL,Keys.SHIFT,'v')    #组合按键















